<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

/**
 * Class CreateAddressesTable.
 */
class CreateAddressesTable extends Migration
{
	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('address', function(Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id')->comment('用户id');
            $table->integer('province')->comment('省');
            $table->integer('city')->comment('市');
            $table->integer('area')->comment('区');
            $table->char('postcode',8)->comment('邮政编码');
            $table->string('receiver', 64)->comment('收货人姓名');
            $table->string('phone', 32)->comment('收货人手机号');
            $table->string('address', 256)->comment('收货人详细地址');
            $table->tinyInteger('is_default')->comment('是否是默认地址')->default(0);
            $table->integer('sort')->comment('排序')->default(0);

            $table->timestamps();
            $table->softDeletes();
            $table->index('user_id');
            $table->engine = 'InnoDB';
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('address');
	}
}
